<?php
defined('IN_IA') or exit('Access Denied');
global $_W, $_GPC;
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
if (!empty($_GPC['keyword'])) {
	$condition .= " AND CONCAT(`bizId`,`orderNum`,`uid`) LIKE '%{$_GPC['keyword']}%'";
}
$list = pdo_fetchall("SELECT * FROM " . tablename($this->tableduiba) . " WHERE uniacid = '{$_W['uniacid']} ' {$condition}  ORDER BY createtime DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}");
if (!empty($list)) {
	$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename($this->tableduiba) . " WHERE uniacid = '{$_W['uniacid']}' {$condition}");
	$pager = pagination($total, $pindex, $psize);
	foreach ($list as &$item) {
		load()->model('mc');
		$fansinfo = mc_fansinfo($item['uid'], $_W['acid'], $_W['uniacid']);
		$item['nickname'] = $fansinfo['nickname'];
		$item['avatar'] = $fansinfo['tag']['avatar'];
	}
}
include $this->template('duiba');